import 'package:flutter/material.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import '../help/cabinet_help.dart';

class CabinetFormBottomCustomDate extends StatelessWidget {
  final String? startTime;
  final String? endTime;
  final Function(CabinetDateCustomType type)? selectAction;
  const CabinetFormBottomCustomDate({
    super.key,
    this.startTime,
    this.endTime,
    this.selectAction,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          width: double.infinity,
          margin: EdgeInsets.only(bottom: 10),
          child: Text(
            "自定义",
            style: TextStyle(color: MGColors.text3Color, fontSize: MGFont.textFont3),
          ),
        ),
        Flex(
          direction: Axis.horizontal,
          children: [
            Expanded(
                child: InkWell(
              child: Container(
                padding: EdgeInsets.only(top: 12, bottom: 12),
                decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(6)),
                child: Text(
                  (startTime != null && startTime!.isNotEmpty) ? startTime! : "年-月-日",
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: (startTime != null && startTime!.isNotEmpty) ? MGColors.text1Color : MGColors.text4Color,
                    fontSize: MGFont.titleFont3,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              onTap: () {
                if (selectAction != null) {
                  selectAction!(CabinetDateCustomType.startTime);
                }
              },
            )),
            Container(
              margin: EdgeInsets.only(left: 15, right: 15),
              child: Text("-",
                  style: TextStyle(
                    color: MGColors.text1Color,
                    fontSize: MGFont.titleFont3,
                    fontWeight: FontWeight.bold,
                  )),
            ),
            Expanded(
                child: InkWell(
              child: Container(
                padding: EdgeInsets.only(top: 12, bottom: 12),
                decoration: BoxDecoration(color: MGColors.backColor, borderRadius: BorderRadius.circular(6)),
                child: Text(
                  (endTime != null && endTime!.isNotEmpty) ? endTime! : "年-月-日",
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: (endTime != null && endTime!.isNotEmpty) ? MGColors.text1Color : MGColors.text4Color,
                    fontSize: MGFont.titleFont3,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              onTap: () {
                if (selectAction != null) {
                  selectAction!(CabinetDateCustomType.endTime);
                }
              },
            ))
          ],
        )
      ],
    );
  }
}
